package com.jt.config;


import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration/*配置类,交给spring容器管理*/
public class MybatisPlusConfig {

    /*mp分页机制， mysql 分页语句和 oracle分页语句  为了实现功能复用 需要手动配置
    * 根据数据库类型不同，之后生成的sql  mp才能调用分页对象
    *
    * */
    @Bean/*将方法返回值对象交给spring容器管理*/
    public MybatisPlusInterceptor  mybatisPlusInterceptor(){
        MybatisPlusInterceptor  interceptor=new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MARIADB));
        return interceptor;
   }
}
